package com.yc.yyds.servlet;

import com.yc.yyds.Bean.Result;
import com.yc.yyds.biz.BizException;
import com.yc.yyds.biz.CommentBiz;
import com.yc.yyds.util.ToJsonUtil;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.Map;

@WebServlet(name = "MovieDescServlet", value = "/MovieDescServlet.s")
public class MovieDescServlet extends HttpServlet {
    CommentBiz biz = new CommentBiz();
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String movieid = request.getParameter("movieid");
        Result result;
        try {
            Map<String, Object> data = biz.query(movieid);
            result=new Result(1,null,data);
            ToJsonUtil.toJson(response,result);
        } catch (BizException e) {
            e.printStackTrace();
            result=new Result(0,e.getMessage(),null);
            ToJsonUtil.toJson(response,result);
        }
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
